package xj.graph2d.shapes;

import java.awt.Graphics2D;

import xj.graph2d.DrawShape;
import xj.graph2d.Group;
import xj.graph2d.util.DrawingUtilities;

public class DisjointGroup extends Group {

  @Override
  public DrawShape makeInstance() {
    return new DisjointGroup();
  }

  @Override
  public void draw(Graphics2D g2) {
    super.draw(g2);
    if (drawGroupFrame) {
      int n = subshapes.size();
      for (int i = 0; i < n; i++) {
	DrawShape shape = subshapes.get(i);
	if (shape.isVisible()) {
	  DrawingUtilities.drawGroupFrame(g2, shape.getBounds(), true);
	}
      }
    }
  }

  @Override
  public void drawOutline(Graphics2D g2) {
    super.drawOutline(g2);
    if (drawGroupFrame) {
      int n = subshapes.size();
      for (int i = 0; i < n; i++) {
	DrawShape shape = subshapes.get(i);
	if (shape.isVisible()) {
	  DrawingUtilities.drawGroupFrame(g2, shape.getBounds(), true);
	}
      }
    }
  }

}
